#include "ecg.h"
#include "beats.h"
#include "ecgsignal.h"
#include "ecgseekpeaks.h"

Ecg::Ecg(QObject* parent)
    : QObject { parent }
{
}

float Ecg::adcGain() const
{
    return m_adcGain;
}

void Ecg::setAdcGain(float newAdcGain)
{
    if (m_adcGain == newAdcGain)
        return;
    m_adcGain = newAdcGain;
    emit adcGainChanged();
}

int Ecg::adcZero() const
{
    return m_adcZero;
}

void Ecg::setAdcZero(int newAdcZero)
{
    if (m_adcZero == newAdcZero)
        return;
    m_adcZero = newAdcZero;
    emit adcZeroChanged();
}

int Ecg::startTimeStamp() const
{
    return m_startTimeStamp;
}

void Ecg::setStartTimeStamp(int newStartTimeStamp)
{
    if (m_startTimeStamp == newStartTimeStamp)
        return;
    m_startTimeStamp = newStartTimeStamp;
    emit startTimeStampChanged();
}

int Ecg::load()
{

    // 测试分析
    // QVector<float> list({-0.10927,-0.14791,-0.22684,-0.12651,-0.15615,-0.13543,-0.13082,-0.12751,-0.19205,-0.29120,-0.09759,-0.18210,-0.20336,-0.18873,0.00816,-0.17644,-0.18889,-0.22528,-0.16191,-0.12974,-0.00436,-0.09164,-0.04773,-0.00441,-0.04316,-0.07133,-0.14374,-0.16264,-0.16861,-0.17603,-0.23559,-0.22698,-0.10524,-0.06127,0.00557,-0.03307,0.29688,0.63506,0.41536,-0.59479,-1.09437,-0.90787,-0.44530,-0.23547,-0.02920,0.06723,0.07834,-0.01948,-0.05644,-0.00644,-0.06298,-0.02836,-0.11631,-0.03460,-0.07508,-0.05165,-0.00877,0.02105,-0.10103,-0.04142,0.02989,-0.06182,-0.04419,0.01132,0.05736,0.01027,-0.04195,-0.07309,-0.08906,-0.04595,-0.01752,-0.09391,-0.12551,-0.05335,-0.03540,-0.10204,-0.16371,-0.17121,-0.10957,-0.12013,-0.07752,-0.06435,-0.13117,-0.08901,-0.05773,-0.09943,-0.22034,-0.07728,-0.12526,-0.16590,-0.17933,-0.02481,-0.03581,-0.10014,-0.08988,-0.01487,-0.03445,-0.18070,-0.22542,-0.07827,-0.08751,-0.14384,-0.13930,-0.06430,-0.04538,-0.01806,0.14181,0.41418,0.52944,-0.11277,-0.79110,-1.11714,-0.62464,-0.26520,0.00535,0.01137,0.03205,0.00150,-0.01619,-0.00323,0.00446,0.02277,-0.06290,-0.06443,-0.01761,-0.00671,0.01341,-0.02192,-0.07938,-0.03921,0.02903,-0.03040,-0.13452,-0.07770,0.03477,-0.08995,-0.06247,-0.06134,-0.00429,-0.09118,-0.08198,-0.17180,-0.07341,-0.06871,-0.07149,-0.18360,-0.15453,-0.08582,-0.00626,-0.03255,-0.10057,-0.07705,-0.21041,-0.16431,-0.07317,-0.10148,-0.12159,0.00646,0.01292,-0.05695,0.00422,-0.01634,-0.04223,-0.11090,-0.06188,-0.07521,-0.06976,-0.06915,-0.06093,-0.06421,-0.22277,-0.18210,-0.08610,0.02373,-0.07030,-0.01322,-0.03247,-0.04026,-0.07606,-0.11781,-0.04488,-0.03632,0.02546,0.19910,0.52633,0.40486,-0.39460,-1.03263,-0.99103,-0.52793,-0.27694,0.07068,0.03994,0.06479,-0.02935,0.03760,-0.04585,0.00452,-0.02298,0.00835,-0.06021,0.00825,-0.03802,-0.01641,-0.06074,-0.00273,-0.05112,-0.00846,-0.02644,0.05769,0.03374,0.07009,0.14895,0.12421,0.01638,-0.01557,-0.02651,-0.19710,-0.19545,-0.14347,-0.16648,-0.09773,-0.02212,0.32372,0.72068,0.50953,-0.36734,-0.88134,-0.77409,-0.41365,-0.24595,-0.15785,-0.09164,-0.10794,-0.05125,0.02171,0.04444,0.00056,0.01124,-0.11741,-0.01519,0.03418,0.00606,-0.03563,-0.04712,-0.05150,-0.06568,-0.14619,-0.07260,0.03824,0.03324,-0.07228,0.07806,0.05733,-0.02725,-0.00655,0.08882,-0.02220,-0.04812,-0.04367,-0.14297,-0.31141,-0.26507,-0.17375,-0.05872,-0.18034,-0.15077,-0.18930,-0.04193,-0.06572,-0.09505,-0.17089,-0.12244,-0.05422,-0.16313,-0.14777,-0.14826,-0.04204,-0.07722,-0.03270,-0.06045,-0.06247,-0.06048,-0.08805,-0.05432,-0.08351,-0.03862,-0.16848,-0.11186,-0.08582,-0.02489,-0.10579,-0.09095,-0.06546,-0.03955,0.17695,0.32869,0.65884,0.42927,-0.35549,-1.09248,-0.83036,-0.37568,-0.11499,-0.04998,0.02502,0.07581,0.12171,0.16827,0.01356,0.00651,-0.03068,0.02031,-0.06892,-0.01304,0.07479,-0.05729,0.01022,-0.04215,0.01056,-0.02661,0.02272,-0.00837,0.01994,0.00164,0.03445,0.01909,-0.00990,0.03873,0.07734,0.03548,0.00411,0.03199,-0.05315,-0.01938,-0.11908,-0.11755,-0.10368,-0.02735,-0.03281,-0.08838,-0.02711,-0.08948,-0.02892,-0.04420,0.01164,-0.07527,-0.04045,-0.03762,-0.01843,0.00749,-0.04645,-0.13576,0.03782,0.38802,0.58074,0.16786,-0.69941,-1.07024,-0.77732,-0.25687,-0.04593,0.16566,0.07424,0.19724,0.08366,0.06801,-0.00738,0.03667,0.03240,-0.01550,-0.02150,-0.05285,0.04194,0.05176,0.05523,-0.02392,-0.00958,0.02488,0.01021,-0.02761,-0.00312,0.08468,0.10349,0.05922,0.03066,-0.01118,-0.04010,-0.23888,-0.18402,-0.13648,-0.11047,-0.05106,0.02289,-0.02307,-0.02139,0.01108,-0.06249,-0.01598,0.07489,-0.09812,-0.05853,-0.05838,0.06978,-0.03211,0.01003,-0.05513,0.06945,0.14331,0.62263,0.79427,0.41576,-0.59949,-1.01138,-0.88306,-0.33852,-0.05837,0.10828,0.14712,0.26645,0.17808,0.03609,0.05157,0.13810,0.08520,0.10338,0.11556,0.10738,0.00800,0.07134,0.01456,0.08333,-0.02713,0.10105,-0.04893,0.06215,0.12285,0.15628,0.15458,0.11967,0.14936,0.06959,0.00850,-0.16085,-0.06965,-0.11661,-0.11856,-0.04063,-0.09776,-0.09352,-0.02309,-0.02106,-0.06327,-0.01978,-0.04227,0.01818,0.04648,0.04300,-0.01961,-0.03639,-0.23883,-0.21441,-0.07316,0.06322,-0.05787,-0.07875,0.07436,0.02594,0.10962,-0.10580,-0.08789,-0.15945,0.02314,-0.07064,-0.16310,-0.05828,0.06592,0.09304,-0.03733,0.05532,-0.02568,-0.00741,-0.04749,-0.04201,-0.05129,-0.12198,0.02852,0.29317,0.62528,0.44932,-0.31087,-0.90737,-0.72546,-0.32492,-0.13739,0.03519,0.07962,0.01772,0.00407,-0.02010,0.01438,0.05833,0.01869,0.04845,0.13702,0.14814,0.06678,0.01275,0.05121,0.06627,0.01352,-0.07726,0.00131,-0.04693,-0.07252,0.01257,0.08583,0.13086,0.08919,0.03651,-0.00292,0.02009,0.06539,-0.03847,-0.03388,-0.03839,-0.04939,-0.13514,-0.09782,-0.09880,-0.04255,-0.07820,-0.13334,-0.07848,-0.01335,0.08055,0.03445,0.05093,0.29722,0.51468,0.47024,-0.25429,-0.91299,-0.95364,-0.40145,-0.11521,0.09052,0.13094,-0.02182,-0.04072,0.06042,0.07059,0.03180,0.14573,0.05029,0.02453,0.17439,0.06924,-0.09558,-0.02974,0.01675,-0.04750,-0.00989,-0.02128,-0.02472,0.02575,-0.01491,-0.01851,0.00893,0.12526,0.03128,-0.12085,-0.17001,-0.06460,-0.17501,-0.18244,-0.18854,-0.15105,-0.15805,-0.05066,-0.08904,-0.07811,-0.13554,-0.02397,-0.01138,-0.03197,0.03808,0.03342,0.02173,-0.01968,-0.03306,-0.12935,-0.11099,-0.09207,-0.12171,-0.03761,-0.05411,0.04857,0.22185,0.61877,0.51388,-0.13808,-0.74565,-1.00168,-0.77815,-0.28363,0.00581,0.10117,0.02986,0.13098,0.04993,0.00674,-0.02517,0.10306,0.00793,-0.01960,-0.01291,-0.11722,0.02374,0.11766,-0.01313,0.06404,0.10159,0.06991,-0.03022,0.00964,-0.00059,0.01858,-0.06014,-0.02318,0.08266,-0.01917,-0.02563,-0.07381,-0.00386,-0.00468,-0.03926,-0.10975,-0.06166,-0.01964,-0.10857,-0.13070,-0.15485,-0.06410,-0.07590,-0.04811,-0.09818,-0.07131,-0.09663,-0.01453,0.00752,-0.07693,-0.08645,-0.06660,-0.00700,-0.05655,-0.02745,-0.04509,-0.08692,-0.12962,-0.01777,-0.15905,-0.13483,-0.14681,-0.00673,-0.11061,0.00917,-0.06635,-0.02416,-0.04373,-0.03400,-0.06353,-0.07198,0.00102,-0.04622,0.04578,0.27647,0.56608,0.47042,-0.37150,-1.01402,-0.95293,-0.33803,-0.12058,0.10065,0.11244,0.11620,0.06656,0.04512,0.05943,-0.04031,-0.00534,-0.00754,0.00756,-0.04229,0.01224,-0.01078,0.05516,0.08863,0.15651,0.16610,0.10498,0.04182,0.00339,0.02934,0.00779,0.02043,0.09755,0.04298,-0.03325,-0.04267,0.08137,-0.00383,0.00584,0.02368,0.01287,-0.00677,-0.05920,-0.14661,-0.06272,-0.13074,-0.04272,-0.04590,-0.04572,-0.11398,-0.00365,-0.03412,-0.06642,0.00030,-0.02351,0.01474,-0.07671,-0.06322,-0.02214,-0.05343,-0.09681,-0.03308,0.01696,-0.12078,-0.07661,-0.00865,-0.08787,-0.10451,-0.04839,0.12744,0.37342,0.73636,0.29572,-0.52176,-1.15106,-0.82859,-0.41418,-0.07603,0.00510,0.15802,0.09753,0.05843,-0.00307,0.11663,0.10072,0.05347,0.08725,-0.00222,-0.02680,0.05463,0.09832,-0.02893,-0.04162,-0.01985,0.06803,0.03982,0.04247,0.05003,0.04771,0.04263,0.10521,0.00071,-0.11120,-0.08232,-0.04713,-0.08169,-0.05034,-0.03562,-0.01539,-0.04925,-0.10256,-0.06847,-0.02920,-0.11216,-0.09047,-0.01010,0.00318,0.05275,-0.01904,-0.02642,-0.01846,-0.00818,-0.09627,-0.03639,-0.06252,-0.03160,-0.06472,0.00280,-0.04271,0.01279,0.01161,-0.01317,-0.00736,-0.02191,0.04869,-0.08992,-0.03131,-0.04093,0.04916,-0.14200,-0.14126,-0.06952,-0.00609,0.37563,0.68633,0.38058,-0.43614,-0.87505,-0.71868,-0.36581,-0.11775,0.10065,0.14036,0.12532,0.09375,0.15959,0.06253,0.03119,0.04234,-0.02499,0.06492,-0.02730,0.09750,-0.02150,0.19893,0.03520,0.11586,-0.05164,0.04783,0.00555,0.03503,0.03800,0.04759,0.00761,-0.02161,0.06983,-0.02934,-0.06744,-0.03269,0.02817,-0.05585,-0.05951,-0.09506,-0.15357,-0.18796,-0.05713,-0.04118,-0.00454,-0.01414,-0.04008,-0.08661,-0.04809,-0.03569,0.03521,0.07885,0.01868,-0.00613,-0.07946,-0.09036,-0.09180,-0.01531,-0.05472,-0.08157,-0.08860,-0.05587,-0.09535,-0.02208,-0.13523,-0.14396,-0.09483,0.02743,-0.07007,-0.01561,0.03631,0.36673,0.56947,0.37502,-0.33341,-0.98975,-0.99759,-0.53058,-0.24968,-0.16067,0.03307,-0.01825,-0.01839,-0.02699,0.02965,0.01465,0.05394,-0.00680,-0.08698,-0.08587,-0.01391,-0.04776,-0.13686,-0.02526,0.00513,0.03665,-0.05960,0.03794,-0.04765,0.00192,-0.06436,0.01978,-0.03185,-0.03138,-0.05940,-0.04170,-0.16737,-0.15930,-0.13739,-0.15149,-0.13853,-0.13697,-0.14751,-0.11761,-0.09506,0.13939,0.41950,0.48849,-0.40266,-0.95655,-1.00806,-0.46543,-0.35980,-0.13539,-0.05930,-0.05056,-0.03716,-0.04157,-0.01529,-0.06016,0.02483,-0.04489,0.01187,-0.03710,-0.10435,-0.08718,-0.06103,-0.11042,-0.14743,-0.14678,-0.05949,-0.09706,-0.06427,-0.07998,0.13934,0.02449,0.02214,0.02950,0.03665,-0.04344,-0.09683,-0.08105,-0.18727,-0.14991,-0.07547,-0.02194,-0.01855,-0.10945,-0.14431,-0.08398,-0.05669,-0.03836,0.02931,0.07703,0.00351,0.03554,0.04224,-0.11135,-0.08532,-0.09102,-0.07894,-0.08561,0.01281,-0.02520,-0.03586,-0.02923,-0.03161,-0.03233,-0.15718,-0.04924,0.03233,-0.00404,-0.04469,0.05336,-0.01906,0.15007,0.40224,0.64080,0.30242,-0.47645,-0.94946,-0.76777,-0.39742,-0.25051,-0.05031,0.05934,0.14796,0.02598,-0.01284,-0.00713,0.08144,0.01570,-0.04618,-0.03920,-0.06968,-0.06999,-0.01754,0.00105,0.01726,0.09499,0.03731,0.03089,0.02328,0.04233,0.02253,0.00749,0.08541,0.18133,0.13986,0.09466,0.07630,0.05102,-0.07477,-0.06796,0.00295,-0.04108,-0.05526,0.01363,-0.04761,-0.04762,0.09572,0.36407,0.37671,-0.41500,-1.04005,-0.90966,-0.24363,-0.00701,0.11677,0.04833,0.09138,0.03517,0.01680,0.03400,0.00804,-0.00605,0.01791,0.02755,0.00188,-0.02662,0.01778,0.02946,-0.02399,-0.02323,0.00589,0.00065,-0.04111,0.07112,0.01963,0.02055,0.08910,0.05634,-0.05618,-0.03533,-0.09182,-0.11479,-0.12456,-0.14499,-0.22193,-0.14849,-0.11161,-0.02608,-0.10594,-0.07390,-0.06074,-0.01274,-0.03847,-0.03295,-0.06781,-0.05303,-0.08240,-0.04613,-0.05467,-0.01653,-0.05122,-0.01470,-0.09783,-0.11880,-0.11072,-0.04392,-0.04153,-0.00615,-0.08253,0.00767,0.30479,0.54427,0.48951,-0.09358,-0.92678,-0.98223,-0.51150,-0.13721,-0.06243,0.05327,0.08408,0.08997,0.07871,0.06806,0.01864,-0.00471,0.01333,-0.03706,0.04474,0.05610,0.13384,0.13637,0.04578,-0.01766,0.06218,-0.05124,-0.03946,0.02762,-0.06006,0.06313,0.04982,0.00477,0.03722,0.06492,-0.06607,0.03492,-0.05638,-0.01420,-0.07368,-0.11197,-0.12216,0.00161,-0.11011,-0.16022,-0.10587,-0.04087,-0.04479,-0.08642,-0.04776,-0.03085,-0.13048,-0.03481,0.12283,-0.02850,-0.08548,-0.17108,-0.17190,-0.16008,-0.09892,-0.14112,-0.05903,0.00882,-0.06668,-0.03766,-0.06345,-0.12318,-0.04853,-0.04280,-0.10618,-0.03859,-0.02353,-0.03122,-0.01252,0.01429,-0.07086,0.15753,0.46502,0.71564,0.05314,-0.73211,-1.11701,-0.55580,-0.30660,0.09563,0.01635,0.06575,0.01052,0.01866,-0.03824,0.05736,0.08720,0.13962,0.07861,0.04770,-0.00598,0.06986,-0.05341,0.07596,-0.00240,-0.03433,-0.04401,0.09446,0.10001,0.01506,0.02419,0.08168,0.06976,-0.03628,-0.05862,-0.03453,-0.02290,-0.03498,-0.04576,-0.05357,-0.06382,-0.06265,-0.01394,0.01923,0.00679,-0.05639,-0.02128,0.03578,-0.07189,-0.04351,0.04437,0.00371,-0.02763,0.09264,0.02720,-0.06702,-0.01933,0.00164,-0.03426,-0.01812,-0.04656,-0.10442,-0.12412,-0.06332,-0.01819,0.00753,0.04752,-0.01752,-0.01334,0.09192,0.05772,-0.10617,-0.07234,0.08599,-0.02395,-0.03892,0.00549,0.35788,0.55702,0.38428,-0.42188,-0.89046,-0.72579,-0.23723,-0.07622,0.05914,0.12917,0.23344,0.07553,0.04047,-0.07084,0.00627,0.07969,0.07961,0.05192,0.02509,0.07460,0.13135,0.15265,0.07839,0.10048,0.04099,0.04764,0.05489,0.11533,0.05562,0.08837,0.05439,0.11384,-0.00270,-0.00349,-0.04142,-0.05120,-0.00071,-0.03286,-0.11537,-0.03532,0.02082,-0.11140,-0.05438,0.00031,-0.03238,0.01995,0.01420,-0.02379,-0.01489,0.07901,0.09179,0.02338,-0.00523,-0.04961,0.00515,0.09740,-0.00472,0.14286,0.35554,0.55396,0.24765,-0.59464,-1.06333,-0.81343,-0.23864,-0.03830,0.18981,0.07040,0.10711,0.07141,0.04685,0.04416,0.14775,0.13963,0.02844,-0.02914,0.08175,0.14743,0.01130,0.15760,0.10330,0.07422,-0.03500,0.07752,-0.03151,-0.01252,-0.06598,0.00445,0.10115,0.02192,-0.07927,-0.09435,-0.05324,-0.06720,-0.06190,-0.06947,-0.06494,0.00694,-0.09559,-0.17011,-0.11026,-0.09368,-0.11930,-0.01563,0.01560,-0.18442,-0.07542,-0.04829,-0.09823,-0.04624,-0.01405,0.07741,0.03950,-0.03799,-0.02257,0.01129,-0.10917,-0.09419,-0.07770,-0.07461,-0.03542,-0.00197,-0.10869,-0.03290,-0.05121,-0.01962,0.01665,-0.01499,0.21737,0.29979,0.51131,-0.17209,-0.70924,-1.08507,-0.54592,-0.29806,0.00258,0.11809,0.14405,0.08800,0.03128,0.11708,0.02973,0.06030,-0.03206,-0.07275,-0.07553,-0.09688,-0.00105,0.03092,-0.00113,-0.05296,0.03061,0.03790,0.14640,0.07494,0.03440,0.09763,0.09287,-0.01260,0.02415,-0.00018,-0.02210,-0.14211,-0.10229,-0.15110,-0.02835,-0.01496,0.02988,0.01368,0.00661,0.04110,0.04220,-0.01223,-0.12794,-0.03104,-0.01988,0.00562,-0.08563,0.02517,-0.08952,0.06145,0.03155,0.01802,-0.11783,-0.00642,-0.03719,-0.10874,-0.02174,-0.05656,-0.00501,0.05768,0.01632,-0.07595,-0.07046,0.00071,-0.09237,-0.04093,0.00085,-0.02110,-0.04844,0.02740,-0.06013,-0.11014,-0.06354,0.03944,-0.00609,-0.01521,0.29164,0.70086,0.57422,-0.24577,-0.97895,-1.00948,-0.54019,-0.07217,-0.02300,0.06096,-0.02341,0.09481,-0.02029,0.17066,0.11869,0.10792,0.01703,0.10438,-0.02080,0.01060,-0.00668,0.03139,0.03371,0.05240,-0.03843,0.09038,0.10204,0.04304,0.16047,0.09927,0.06633,0.00454,0.03197,-0.07996,-0.00566,-0.03660,-0.09578,-0.06670,-0.05271,-0.01282,-0.08525,-0.07056,-0.01140,-0.01718,-0.03237,0.07011,0.00187,-0.04517,-0.01858,0.03409,0.08904,0.02860,0.01326,0.08454,0.36207,0.60343,0.11739,-0.71057,-0.93093,-0.56154,-0.20295,0.00109,0.10410,0.11354,0.16063,0.12069,0.09486,0.02369,-0.00830,0.05765,0.11979,0.09747,0.13387,0.11374,0.03201,0.00916,0.07634,0.06640,0.05904,0.02285,-0.01908,0.05805,0.16300,0.04192,0.04285,-0.05451,0.05959,0.01624,0.00144,-0.05668,-0.16854,-0.09289,-0.01631,0.02444,-0.06811,-0.01639,-0.00146,0.07627,-0.02332,-0.06249,-0.03899,0.04749,0.06518,0.02905,0.08260,0.23258,0.61593,0.65059,0.21282,-0.73908,-1.05078,-0.77352,-0.18346,-0.01183,0.15184,0.18010,0.34479,0.19091,0.16604,-0.04336,0.10326,0.10265,0.10966,-0.03330,0.07992,0.14062,0.04585,0.06460,0.05896,0.21362,0.18247,0.17051,0.09225,0.02778,0.04612,0.09249,0.05718,0.02088,0.07560,0.04662,-0.03253,-0.03082,-0.06846,0.00102,-0.10800,-0.17127,-0.11593,-0.04144,-0.02761,-0.05338,-0.01985,-0.03361,0.03081,-0.00217,-0.03746,0.03985,0.05379,0.04940,-0.02377,-0.02934,-0.00064,-0.00179,-0.02897,-0.01955,-0.06186,-0.08222,-0.01521,0.05677,0.00036,0.05301,-0.02649,0.04671,-0.02089,-0.03354,-0.00902,0.04813,-0.01010,-0.06071,0.04547,0.01406,-0.01181,-0.03938,0.01945,-0.00742,0.01322,-0.01752,-0.07875,-0.07072,-0.05387,0.05887,-0.00006,-0.01355,0.03667,0.04768,0.07510,0.17509,0.05069,-0.03486,0.23180,0.55591,0.61600,0.12765,-0.69570,-1.01268,-0.70155,-0.11976,-0.01323,0.05793,0.04415,0.25963,0.14247,0.21539,0.16893,0.21282,-0.02491,0.06773,0.04304,-0.02733,0.00160,0.06016,0.02161,0.06564,0.02559,0.10418,0.10839,0.05618,-0.08524,0.06477,0.01553,0.11737,0.08863,0.12483,-0.03588,0.00873,-0.03391,-0.06493,0.12273,0.14792,0.03743,0.04289,0.03937,-0.05440,0.02377,-0.06630,-0.13188,-0.08035,0.07028,0.07171,0.07927,0.08509,0.08348,0.47235,0.68342,0.29782,-0.64653,-0.86269,-0.56010,-0.12559,0.08674,0.04272,0.02869,0.07078,0.12601,0.15155,0.18830,0.23503,0.13575,0.20007,0.13020,0.20391,0.08070,0.20118,0.13487,0.14090,0.06301,-0.00666,0.00393,-0.01699,0.01592,-0.02540,0.13944,0.14565,0.09808,0.03381,-0.02830,-0.04847,-0.08010,-0.05906,-0.17338,-0.10384,-0.13154,-0.08917,-0.17432,-0.05317,-0.05993,0.09696,-0.04814,-0.00244,0.06380,0.02997,-0.01193,0.06342,0.04119,0.08237,0.02765,-0.06181,-0.15121,0.00345,0.00140,0.06593,-0.09385,0.03857,-0.03664,-0.01904,-0.05486,0.15607,0.14455,0.02422,-0.03863,-0.01213,-0.01402,0.09182,0.07834,-0.06061,-0.05621,0.01643,-0.02612,0.01879,0.22697,0.68622,0.80262,0.05832,-0.75338,-0.89258,-0.56847,-0.21243,-0.01725,0.14579,0.10880,0.12030,0.10373,0.16057,0.02468,0.02031,0.08655,0.13971,0.07759,0.12621,0.08558,0.07262,0.08903,0.04194,-0.01397,0.06534,0.01167,-0.00378,0.06341,0.10251,-0.01092,0.07310,0.07144,0.14530,0.07158,0.09576,0.08510,0.03319,-0.11272,-0.08996,0.00643,0.04692,0.00669,-0.11422,-0.06776,0.01078,-0.00872,-0.00378,-0.00514,-0.00620,-0.04978,0.07182,0.02902,-0.08252,-0.02155,0.02523,-0.02047,0.00294,0.05459,-0.02389,0.01427,0.01866,-0.02291,-0.05618,-0.08418,0.03791,0.03477,-0.01422,-0.06211,0.32727,0.72457,0.56450,-0.13717,-0.81971,-1.00869,-0.57090,-0.09995,0.02745,0.16720,0.17957,0.12303,0.00661,0.16314,0.05658,0.03339,-0.04514,0.08508,0.07290,0.06404,0.11240,0.11068,0.14546,0.07087,0.02860,0.08329,0.12976,0.02945,0.11636,0.14523,0.01618,-0.00266,0.03498,0.00031,-0.02506,-0.06196,-0.02182,0.05208,-0.03073,-0.02273,-0.05351,-0.01969,-0.00646,0.01051,-0.09508,-0.05714,-0.04568,-0.02376,-0.05047,-0.03982,-0.01000,0.04045,0.16869,0.01306,-0.04959,0.01836,-0.05677,-0.08106,-0.00542,0.04706,-0.03319,0.08676,-0.00460,-0.02351,-0.05644,0.04761,0.35257,0.60925,0.62249,-0.16006,-0.83881,-1.00906,-0.51090,-0.13159,0.03565,0.10831,0.08877,0.14388,0.07108,0.13210,0.09592,0.04142,0.07584,0.12324,0.02776,0.07980,0.12387,0.11555,0.06429,0.03424,-0.05997,0.10431,0.17051,0.02259,-0.03108,0.03196,0.07497,0.05974,0.02252,0.01182,0.06582,-0.05455,-0.05409,0.00562,-0.02401,-0.09247,0.02821,-0.00274,-0.06352,-0.00152,-0.01952,-0.09147,-0.05352,0.00214,-0.01565,0.03809,-0.01275,0.09960,0.13575,0.02681,-0.08541,0.04179,-0.03799,-0.00639,0.02448,0.06139,0.02935,0.00338,-0.05778,-0.05998,0.08755,-0.07192,-0.01946,0.04554,0.06803,-0.04978,0.11269,0.09433,0.01807,-0.01502,0.02901,-0.01575,-0.02800,-0.00684,0.01942,0.25769,0.62142,0.71492,0.19361,-0.54661,-0.84563,-0.59965,-0.18864,-0.01232,0.16854,0.14249,0.11934,0.00264,0.07473,0.07047,0.10864,0.03512,0.20913,0.12153,0.14456,0.00941,0.08465,0.05685,0.07044,0.03399,0.07243,0.02748,0.08050,0.06665,0.11022,0.06959,0.16704,0.08954,0.13268,-0.00935,0.06492,-0.00453,-0.00593,-0.13188,-0.02754,-0.03621,-0.01003,-0.02138,0.06535,0.02729,-0.04845,-0.05698,0.00790,-0.10128,-0.00744,0.01434,0.08462,0.03999,0.04000,-0.00180,0.08305,0.08598,0.12670,0.04386,0.04338,0.02709,0.02510,-0.13506,-0.17955,-0.16529,-0.05773,0.07254,0.05278,0.05015,0.12272,0.05091,0.09651,0.12873,0.52089,0.62688,0.26265,-0.67781,-0.94582,-0.62968,-0.13665,-0.02154,0.19425,0.16352,0.04601,-0.00831,0.10536,0.03457,0.06506,0.07884,0.13174,0.14104,0.04979,-0.01123,0.06121,0.14047,0.12580,0.17780,0.07050,0.04451,0.03515,0.06468,0.13712,0.01041,-0.01434,0.03178,0.13433,-0.08111,-0.05034,-0.06419,-0.01957,-0.03868,-0.05170,-0.08970,-0.06257,-0.05596,-0.02515,0.00278,-0.03242,-0.02109,-0.07209,-0.03144,0.07159,-0.00053,-0.01474,0.08412,0.03944,0.03056,0.11100,0.14540,-0.04291,0.01143,0.08902,-0.02924,-0.07964,-0.01398,0.01944,0.03104,-0.04850,0.13337,-0.02206,0.00264,0.04270,0.17411,-0.08440,0.15061,0.38724,0.65141,0.57421,-0.09622,-0.74987,-0.88880,-0.43999,-0.07345,0.14955,0.08725,0.15084,0.17611,0.17819,0.02561,-0.01638,0.08561,0.03583,0.00440,0.04555,-0.01063,0.06447,0.12454,0.13539,0.05835,0.09649,0.02239,0.02024,0.05027,0.13548,0.15711,0.15850,0.07396,0.04561,0.04593,0.00807,-0.04479,-0.05952,-0.05890,-0.02040,-0.00252,0.08595,0.47342,0.76540,0.29575,-0.66926,-0.87975,-0.66028,-0.16673,-0.03415,0.04730,0.01658,0.08189,0.06504,-0.04456,-0.00313,0.04854,0.05505,0.02006,0.06106,0.07863,0.12013,0.03345,-0.03391,0.04356,0.13046,0.09604,0.09732,0.08016,0.17174,0.15828,0.11042,0.04935,0.05876,0.03887,0.06137,0.03163,0.02267,0.01874,-0.02303,-0.05274,-0.04404,-0.14129,0.01728,-0.02870,0.00370,-0.04837,0.06820,-0.06442,0.01147,0.04501,-0.04593,0.14235,0.03240,-0.03097,-0.03959,0.13269,-0.07319,0.02059,-0.00395,0.00212,0.07554,0.11545,0.11114,-0.01620,-0.00844,-0.01720,-0.02086,0.06703,0.51101,0.82268,0.55358,-0.27368,-0.83626,-0.88476,-0.46916,-0.07642,0.15797,0.20271,0.15466,0.15738,0.18971,0.07729,0.10686,0.13032,0.13452,-0.01981,0.09028,0.08031,0.16806,0.13333,0.09087,0.12713,0.14755,0.15035,0.05265,0.15921,0.07260,0.06267,0.02349,0.13246,0.13637,0.22671,0.05920,0.11669,0.01717,0.04040,-0.02001,0.11622,-0.08290,-0.01837,-0.10361,0.04923,0.17825,0.62448,0.41617,-0.43051,-1.01646,-0.66715,-0.25733,0.05364,0.20579,0.22901,0.20081,0.15945,0.21428,0.12508,0.08069,-0.00324,0.07068,0.00050,0.06176,0.03296,0.06879,0.18800,0.03251,0.07971,0.01305,0.19352,0.13087,0.15901,0.10425,0.26649,0.11503,0.03576,0.05922,-0.02536,-0.02412,0.00780,-0.00126,0.00258,0.00546,-0.00907,-0.00977,-0.11574,-0.10561,-0.04877,-0.05239,0.03592,0.03685,0.03271,0.06403,0.05295,0.02479,0.05352,0.03536,-0.00921,-0.01907,-0.08566,0.03969,0.05895,0.08104,-0.03981,-0.00127,0.09366,0.08639,0.04960,0.01273,0.00441,0.01992,0.14150,-0.02908,-0.00924,-0.06070,-0.00681,0.13288,0.08826,0.03929,0.38522,0.69881,0.65357,0.16240,-0.50353,-0.93998,-0.68339,-0.27102,-0.02913,0.11001,0.09483,0.19174,0.15504,0.14690,0.11469,0.12096,0.03368,0.13341,0.14954,0.06703,0.00899,0.10596,0.09870,0.01899,0.06234,0.02516,0.09245,0.04078,0.18190,0.06208,0.11875,0.10374,0.24077,0.16531,0.10299,0.07097,0.11828,0.04285,-0.01746,0.01275,0.01696,0.03187,0.08168,0.00285,-0.06706,-0.04256,0.04045,0.01961,0.07926,0.16012,0.03363,0.09399,0.10263,0.04027,-0.02328,0.18938,0.09739,-0.02425,-0.06113,-0.04352,-0.02757,0.02238,-0.01775,-0.11186,0.03383,0.02187,0.00105,0.20219,0.61054,0.60126,0.04493,-0.64058,-0.90675,-0.44183,-0.08720,0.07246,0.08900,0.11062,0.10967,0.11075,0.19464,0.21301,0.09746,0.10854,0.11351,0.11247,0.17356,0.19000,0.03094,-0.04277,0.20680,0.11724,0.02892,0.01110,0.21213,0.07213,0.12805,0.09299,0.12949,0.04786,0.14337,0.01873,0.01303,-0.01222,-0.03923,-0.04906,0.04712,0.03160,-0.00932,-0.03924,-0.02783,-0.05973,0.00243,0.07830,0.01763,0.01031,0.06619,0.04870,-0.02754,0.03067,0.07957,-0.02606,0.02179,-0.02771,0.00794,0.08154,0.11870,0.00412,0.04164,-0.02504,0.04459,0.09591,0.07656,0.02268,0.09467,0.02260,-0.09155,0.02642,0.24379,0.65527,0.60396,-0.05830,-0.80514,-0.76151,-0.42701,-0.04844,0.07064,0.12460,0.04045,0.20120,0.20193,0.16496,0.10243,0.12296,0.10730,0.10888,0.04233,0.08691,0.03273,0.12125,0.01824,0.21909,0.13326,0.18935,0.16467,0.15891,0.06584,0.13567,0.22480,0.18705,0.15843,0.09955,0.00789,-0.04650,-0.09089,-0.03907,-0.11531,-0.04936,-0.05492,-0.01979,-0.00391,0.04875,0.03914,0.07814,0.11151,0.09513,-0.00247,0.06324,0.09327,0.02704,-0.08131,-0.03816,-0.00349,-0.00306,-0.00899,-0.04743,-0.02373,0.01972,0.03522,0.11355,-0.01647,0.10420,0.06142,0.18283,-0.06438,0.03772,-0.07293,0.03938,-0.09418,-0.00931,-0.05223,-0.01748,-0.03726,0.06233,0.00573,0.07132,0.07304,0.08239,0.04675,0.02399,0.00052,-0.01914,0.03870,0.05100,0.02908,0.10466,0.02912,0.00851,-0.07021,0.14585,0.03027,0.04813,0.12382,0.59602,0.83112,0.60265,-0.35125,-0.89416,-0.83644,-0.31281,-0.09966,0.11445,0.15383,0.20065,0.18117,0.19357,0.09333,0.12581,0.14038,0.11986,0.12015,0.13261,0.13494,0.04084,0.10237,0.07050,0.18444,0.07578,0.06567,0.01414,0.01078,0.09539,0.08213,0.12257,0.11588,0.18965,0.25411,0.16642,0.12300,0.04837,0.07576,0.05489,0.01743,-0.08991,-0.02520,0.10530,0.04748,-0.01602,0.12130,0.51360,0.49298,-0.31400,-0.97103,-0.94617,-0.17776,0.14130,0.21827,0.12359,0.18585,0.24249,0.20069,0.04316,0.09068,0.06712,0.04836,0.15225,0.18875,0.12855,0.08252,0.06739,0.06304,0.08313,0.04272,0.14566,0.16535,0.15440,0.11686,0.14430,0.14073,0.14804,0.04794,0.05238,-0.02759,0.08001,0.02637,0.03363,0.05961,-0.01662,-0.03002,-0.09795,-0.08719,-0.08002,-0.05150,-0.04716,0.05163,0.05307,0.00669,0.03670,-0.00338,-0.00159,0.07896,0.04534,0.02505,-0.05276,0.04122,0.05055,-0.02621,-0.04977,0.05814,0.00600,0.03430,-0.04300,0.00955,0.08177,0.11485,0.15947,0.65391,0.71337,0.13493,-0.66084,-0.88402,-0.59568,-0.10351,0.03374,0.10905,0.11176,0.19912,0.10254,0.18833,0.15501,0.09237,0.00752,0.12181,0.14804,0.09831,0.05296,0.08925,0.14617,0.07997,0.04230,0.04579,0.11573,0.15370,0.09251,0.06456,0.07040,0.02903,0.05477,0.19382,0.14671,0.05407,0.07473,0.04220,-0.00625,-0.01046,-0.01759,0.03890,0.12383,0.17021,0.12026,0.12906,-0.06441,-0.06309,-0.08572,-0.03628,0.00064,0.10877,0.09985,0.04419,0.06140,0.05521,-0.04884,-0.05535,-0.00209,0.00151,-0.01556,0.00400,0.05145,0.01912,0.07464,0.08955,0.03945,-0.02900,0.13186,0.10479,-0.10548,-0.05733,-0.04164,0.17503,0.33231,0.65535,0.33750,-0.38983,-0.89857,-0.64979,-0.29718,-0.06510,0.16080,0.18462,0.20290,0.17845,0.05924,-0.00186,-0.00773,-0.02617,0.00045,0.07507,0.09685,0.07635,0.12572,0.13261,0.08199,0.08974,0.14667,0.16045,0.14257,0.14331,0.02740,0.03035,0.02955,0.04884,0.19838,0.06220,-0.02623,-0.01058,0.00903,0.07121,0.02288,-0.02125,-0.02299,0.08782,-0.06543,-0.02654,0.01927,0.06561,-0.04367,0.04926,0.10049,0.06884,-0.05442,-0.00691,0.00239,-0.00411,0.13162,0.12198,0.11701,0.00702,0.13682,0.05000,0.00003,0.00074,-0.00593,0.02188,-0.02930,0.06778,-0.00024,-0.00088,0.00663,0.00998,-0.01097,-0.04894,0.03645,0.27773,0.53943,0.69915,0.02339,-0.64284,-0.97110,-0.51856,-0.25087,0.01129,0.13229,0.19180,0.17625,0.18733,0.06968,0.07546,-0.00250,0.07434,0.10415,0.05067,0.02126,0.10564,0.09220,0.04965,0.12101,0.12945,0.08655,0.09447,0.11734,0.14506,0.08380,0.11869,0.02570,0.14145,0.07591,0.02279,0.01222,0.01311,-0.12900,-0.04063,-0.04746,-0.02001,0.05131,0.00619,0.02891,-0.03133,0.01460,0.11658,0.00543,0.04117,-0.01439,0.01453,0.01257,0.05028,-0.04781,0.07990,0.12057,0.04905,0.13816,-0.00094,0.00550,-0.03965,0.07595,0.02418,0.12745,-0.04528,-0.03195,-0.03700,0.30551,0.54496,0.53392,-0.19249,-0.87035,-0.95426,-0.42799,-0.07257,0.08853,0.12359,0.21925,0.21070,0.22579,0.10120,0.06744,0.06933,-0.02105,0.06634,0.04597,0.12910,0.09031,0.25526,0.04362,0.16267,0.12176,0.21279,0.01706,0.05705,0.01077,0.08110,0.14532,0.20528,0.12029,0.04405,0.01686,-0.01719,-0.12925,0.02349,-0.00705,0.04344,-0.04224,0.05222,0.00079,-0.03204,-0.00899,0.08047,0.17194,0.11088,0.02628,0.01802,0.00922,0.07677,-0.00368,0.07414,0.08624,0.10981,0.00730,0.05673,0.01058,0.09658,0.08946,0.09311,0.04347,0.03083,0.06433,0.03010,0.10793,-0.04747,0.00466,0.04033,0.08458,0.00189,-0.01304,0.16535,0.39033,0.73062,0.65994,-0.13048,-0.81725,-0.81923,-0.34087,-0.08259,0.16514,0.08140,0.23153,0.21352,0.09694,0.12414,0.18616,0.13354,0.14565,0.12091,0.07015,0.01842,0.16385,0.14249,0.10451,0.02746,0.16704,0.11326,0.20155,0.24317,0.07564,0.14311,0.11434,0.03145,0.04111,0.24338,0.11254,0.10509,-0.00691,0.04912,-0.04035,0.13702,-0.03253,-0.01109,-0.01878,0.10503,-0.02972,-0.03027,-0.03376,0.06511,0.13677,0.04495,0.02554,0.06854,0.11385,0.14867,0.03403,0.02931,0.09277,0.12679,-0.04069,-0.02866,-0.05248,-0.02040,0.01835,-0.01670,-0.05444,0.00966,0.05981,0.07399,0.01637,0.05463,0.06196,0.02038,0.10950,0.41389,0.66636,0.49890,-0.11228,-0.81760,-0.92249,-0.52942,-0.16770,0.02924,0.28308,0.17025,0.15500,0.11667,0.15627,0.07335,0.25269,0.13037,0.08063,0.10478,0.11097,0.04719,-0.01883,0.09678,0.08625,0.05675,0.12822,0.25678,0.10844,0.12557,0.17122,0.13544,0.09183,0.09650,0.16290,0.01169,-0.03047,-0.05681,0.00022,-0.00529,0.02982,-0.05426,0.06798,0.06796,0.08624,-0.01851,0.11676,0.01442,0.06999,0.02079,0.02682,-0.05435,0.08724,-0.01282,-0.03958,-0.04230,0.11477,0.11035,0.15866,-0.03977,-0.01950,-0.04172,0.05499,-0.09005,-0.01115,-0.02493,0.00082,-0.04752,0.04480,0.04943,0.05588,-0.00931,0.03748,0.15793,0.44326,0.65751,0.54534,-0.30253,-0.82408,-0.70838,-0.22267,-0.05779,0.15199,0.17753,0.23164,0.07994,-0.03402,-0.08466,0.06096,0.14446,0.20023,0.18697,0.22413,0.11237,0.06572,0.10012,0.09700,0.11189,0.00529,0.07429,-0.00715,0.10913,0.03789,0.16539,0.12028,0.22852,0.13117,0.07909,0.02086,0.00040,-0.01722,-0.01543,-0.05956,-0.03302,0.27031,0.64371,0.81076,0.11808,-0.71319,-0.78403,-0.42811,-0.20895,-0.09593,0.08893,0.04483,0.05970,0.18573,0.12318,0.07632,0.03161,0.14942,0.10164,0.10781,0.00657,-0.01182,0.03451,0.03763,0.10149,0.14805,0.09561,0.05637,0.04410,0.06219,0.13969,0.16528,0.12088,0.16134,0.14517,0.09381,0.07106,0.02380,-0.05058,-0.03820,0.01625,0.02379,-0.03548,-0.00816,0.01118,-0.00083,-0.06576,-0.00515,0.04890,0.03288,0.03376,0.05621,0.07705,0.06837,-0.03398,-0.04456,-0.00388,-0.03148,-0.05815,-0.00831,0.03449,0.14907,0.16154,0.02020,-0.08378,0.13093,0.05472,0.08279,0.00006,0.08886,0.00030,-0.00360,0.00976,0.29897,0.62576,0.67749,0.01727,-0.75069,-0.93477,-0.49174,-0.10957,0.07705,0.18385,0.11314,0.12703,0.13514,0.07196,0.06291,0.08876,0.11835,0.17937,0.11233,0.00041,-0.01335,0.09597,0.06340,0.14053,0.08958,0.00233,-0.03385,0.15985,0.12921,-0.02835,0.03440,0.08780,0.13766,0.17961,0.19403,0.14679,0.18428,-0.01874,-0.03227,0.02849,0.06591,-0.01560,0.00213,0.34362,0.68991,0.38423,-0.56251,-1.00744,-0.75155,-0.23562,0.11511,0.21667,0.21096,0.11659,0.08457,0.09884,0.06783,0.01796,0.03700,0.14054,0.05128,0.06221,-0.04661,0.09520,0.05818,0.10725,0.09223,0.04595,0.07758,0.06533,0.03350,-0.04756,0.10315,0.11928,0.08330,0.23209,0.11622,0.09873,0.05622,0.06804,-0.09815,-0.11592,-0.12623,-0.15302,-0.01783,0.02932,0.03654,-0.00553,0.00969,0.09372,-0.03213,0.04504,0.06441,0.07376,0.03856,-0.00718,-0.04960,0.02644,0.05805,0.01458,-0.02784,-0.02411,-0.02310,0.10258,0.01748,0.10776,0.01428,0.21382,0.52318,0.84707,0.47285,-0.45671,-0.94297,-0.69252,-0.32036,-0.10316,0.14056,0.23977,0.03330,0.15784,0.07650,0.12278,-0.02039,0.14870,0.11229,0.17947,0.11836,0.19891,0.21001,0.25224,0.10624,0.06972,0.02124,0.01227,-0.15792,-0.01830,0.05996,0.06131,0.14599,0.14702,0.16199,0.12963,0.23146,0.13426,0.03048,-0.02870,-0.04234,0.04956,-0.00891,0.05465,-0.12555,0.04196,-0.00732,0.05126,0.01392,0.43743,0.45408,-0.02288,-0.78672,-0.72471,-0.27678,0.16078,0.13640,0.20741,0.23353,0.25733,0.18430,0.10663,0.05029,-0.02031,-0.01137,0.02510,0.09095,0.06555,0.15681,0.11682,0.06699,0.11759,0.10912,0.11499,0.09949,0.12657,0.03584,0.01832,-0.05207,-0.03324,0.17556,0.02025,-0.06254,-0.06139,0.02739,-0.00882,0.01899,-0.05271,-0.08725,0.09425,-0.05426,-0.02809,-0.08998,-0.02234,-0.10872,0.02097,0.05751,0.03014,0.07141,0.06791,0.06597,-0.00894,0.02097,0.04980,0.01165,-0.02325,-0.01414,0.07776,0.03646,0.15327,0.14307,0.15749,0.42066,0.65364,0.23346,-0.54769,-0.97051,-0.66135});
    // EcgSeekPeaks ecgeeekpeaks;
    // ecgeeekpeaks.recognition(list);
    // return 0;
    setSampleRate(200);
    setAdcZero(0);
    setAdcGain(6727.4f);

    QDateTime dateTime = QDateTime::fromString("2024-08-07 21:11:16", "yyyy-MM-dd hh:mm:ss");
    int timestamp = dateTime.toSecsSinceEpoch();
    setStartTimeStamp(timestamp);

    Beats& beatsModel = Beats::getInstance();
    // beatsModel.loadQHashFromBinaryFile();

    EcgSignal& ecgsignal = EcgSignal::getInstance();
    ecgsignal.readBinaryFile("..\\data\\929489417427488768\\17231236506219.BIN3_16");
    //计算总持续时间
    setDuration(ecgsignal.signalSize / sampleRate() * 1000);

    //分析
    QVector<float> list(ecgsignal.data[0].size());
    for (int i = 0; i < ecgsignal.data[0].size(); ++i) {
        list[i] = (ecgsignal.data[0][i] - m_adcZero) / m_adcGain;
    }
    QDateTime startTime = QDateTime::currentDateTime();
    EcgSeekPeaks ecgeeekpeaks;
    ecgeeekpeaks.recognition(list);
    QDateTime endTime = QDateTime::currentDateTime();
    qint64 diffInMilliseconds = startTime.msecsTo(endTime);
    qDebug() << "时间差（毫秒）: " << diffInMilliseconds;
    beatsModel.processBeatsData();
    // for (int i = 0; i < 10; ++i) {
    //     qDebug() << beatsModel.data[beatsModel.rPeaksInAlls[i]];
    // }

    // ecgsignal.getEcgSignalFragment(100,10000);
    // qDebug() << ecgsignal.getEcgSignalFragment(1,1000);


    return 1;
}

int Ecg::duration() const
{
    return m_duration;
}

void Ecg::setDuration(int newDuration)
{
    if (m_duration == newDuration)
        return;
    m_duration = newDuration;
    emit durationChanged();
}

int Ecg::sampleRate() const
{
    return m_sampleRate;
}

void Ecg::setSampleRate(int newSampleRate)
{
    if (m_sampleRate == newSampleRate)
        return;
    m_sampleRate = newSampleRate;
    emit sampleRateChanged();
}

Ecg& Ecg::getInstance()
{
    static Ecg instance; // 静态局部变量，确保只初始化一次
    return instance;
}
